//
// Created by LiuYou on 2021/8/4.
//

#include <cstring>
#include "Proto.hpp"

// 友元函数是一个函数, 不是类的成员函数！但是在命名空间内还是要加上SocketBasic::限定符的, 编译器会警告。
// 但是不加SocketBasic::限定符, 编译器会报错！
std::ostream& SocketBasic::operator<<(std::ostream& os, const SocketBasic::Msg& msg) {
    os << "Msg{";
    os << "name: " << msg.name << " math: " << msg.math << " chinese: " << msg.chinese;
    os << "}";
    return os;
}

SocketBasic::Msg::Msg(char* name, uint32_t math, uint32_t chinese) :
        math( math ),
        chinese( chinese ) {
    strcpy((char*) this->name, name );
}

SocketBasic::Msg::Msg() = default;
